#include <iostream>
using namespace std;

int main()
{
	while(true)
	{
		int n;
		cin >> n;
		int s, m;
		cin>> s >> m;
		if(s==0 && n == 0 && m == 0)
		{
			break;
		}
		int arr[100] = {0};
		int cnt = 1;
		int pos = s;
		int num = 0;
		while(num <= n)
		{
			
			if(pos == n+1)
			{
				pos = 1;
			}
			if(arr[pos]!=0)
			{
				pos++;
				continue;	
			}
			if(cnt == m)
			{
				cnt = 1;
				arr[pos] = 1;
				num++;
				if(num!=n)
					cout << pos << ",";
				else
				{
					cout << pos <<endl;
					break;
				}
					
			}
			else
			{
				cnt++;
				
			}
			pos++;
		}
		
	}
	return 0;
}
